package com.example.zhyq.sign

import androidx.lifecycle.MutableLiveData
import com.example.base.entity.SignBean
import com.example.base.entity.SignBeanItem
import com.example.base.mvvm.BaseViewModel
import com.example.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class SignViewModel @Inject constructor(val apiService: ApiService) : BaseViewModel() {

    val getSigns = MutableLiveData<SignBean>()

    val sign = MutableLiveData<SignBeanItem>()

    fun getSigns(uid:Int) {
        httpRequest({apiService.getSigns(uid)},{getSigns.postValue(it)})
    }

    fun sign(item:SignBeanItem) {
        httpRequest({apiService.sign(toBody(item))},{sign.postValue(it)})
    }
}